Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

Miscellaneous methods

Method

passForInternetItem:account:server:path:port:keychainPath:error:

Summary

Retrieves an Internet keychain password from the keychain at the specified path. Returns the first match.

The server, path and port parameters are optional; you can provide missing value for any and all of them.

For a URL like "http:/www.apple.com:80/blah/blah", the server is "www.apple.com", the port is 80, and the path is "/blah/blah"

Returns missing value if not found; check localizedDescription of error for explanation.

Signature

+ (NSString *)passForInternetItem:(NSString *)itemName account:(NSString *)theAccount server:(NSString *)theServer path:(NSString *)thePath port:(NSNumber *)thePort keychainPath:(NSString *)keychainPath error:(NSError *__autoreleasing *)outError

Parameters

itemName = name of the keychain item

theAccount = account name in keychain item

theServer = see summary

thePath = see summary

thePort = see summary

keychainPath = path to the keychain to use

outError = missing value or reference

Result

The password string

Availability

Version 1.3.0

Notes

If you set outError to reference, the result will be a list of two items. If there is no error, the first item will be the result of the method and the second will be missing value. If there is an error, the first item will be missing value and the second item with be an NSError.

Sample

use scripting additions

use framework "Foundation"

use script "BridgePlus"

load framework


set {theResult, theError} to current application's SMSForder's passForInternetItem:"Name" account:"account_name" server:"www.blahblah.com" |path|:"/blah/blah" |port|:80 keychainPath:"/Users/shane/Desktop/Test.keychain" |error|:(reference)

if theResult = missing value then error (theError's localizedDescription() as text)

ASify from theResult

--> "password"

theResult as text

--> "password"


Click here to open script in a script editor